package cwmimagetest;

import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;

/**
 *
 * @author scalan
 */
public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        int width = 100;
        int height = 100;
        BufferedImage bufferedImage = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
        Graphics2D g2d = bufferedImage.createGraphics();
        Color back = new Color(255, 255, 255, 0);
        g2d.setColor(back);
        g2d.fillRect(0, 0, width, height);
        g2d.setColor(Color.black);
        g2d.fillOval(0, 0, width, height);
        g2d.dispose();

        try {
            File file = new File("newimage.png");
            ImageIO.write(bufferedImage, "png", file);
            file = new File("newimage.jpg");
            ImageIO.write(bufferedImage, "jpg", file);
        } catch (IOException e) {
        }
    }
}
